package com.example.check.service;

import com.example.check.mapper.RoleMapper;
import com.example.check.entity.RoleEntity;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;

/**
 * Created by Tony Yao on 2017/7/15.
 */
@Service
public class RoleServiceImpl implements RoleService {
    @Autowired
    RoleMapper rdao;


    @Override
    public ArrayList<RoleEntity> searchAllRole() throws Exception {
        return rdao.selectAllRole();
    }

    @Override
    public ArrayList<RoleEntity> SearchRoleByField(String field,String code) throws Exception {
        return rdao.selectRoleByField(field,code);
    }

    @Override
    public ArrayList<RoleEntity> SearchRoleLikeByField(String field, String code) throws Exception {
        return rdao.selectRoleLikeByField(field, code);
    }

    @Override
    public ArrayList<RoleEntity> SearchRoleById(int id)throws Exception{
        return rdao.selectRoleById(id);
    }

    @Override
    public void deleteRoleById(int id) throws Exception {
        rdao.deleteRoleById(id);
        return;
    }

    @Override
    public void insertRole(RoleEntity role) throws Exception {
        rdao.insertRole(role);
        return;
    }

    @Override
    public void editRole(RoleEntity role) throws Exception {
        rdao.editRole(role);
        return;
    }
}
